package com.example.myesstudy.pojo;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.Date;

@Data
//@Document(indexName = "book", type = "_doc")
@Document(indexName = "book")
public class ReadBook implements Serializable {

    @Id
    private int bookId;

    // 这里配置了分词器，字段类型，可以不配置，默认也可
    @Field(analyzer = "ik_max_word", type = FieldType.Text,searchAnalyzer = "ik_smart")
    private String bookName;


    @Field(analyzer = "english", type = FieldType.Text)
    private String bookEnName;


    @Field( type = FieldType.Keyword)
    private String author;


    @Field(type = FieldType.Text)
    private String imgurl;

    @Field(analyzer = "ik_max_word", type = FieldType.Text,searchAnalyzer = "ik_smart")
    private String discription;

    @Field(type = FieldType.Long)
    private Date createTime;

    @Field(type = FieldType.Text)
    private int creator;

    @Field(type = FieldType.Long)
    private Date updateTime;

    @Field( type = FieldType.Integer)
    private int status;

    @Field( type = FieldType.Integer)
    private int commentNum;

    @Field( type = FieldType.Integer)
    private int price;

    @Field(type = FieldType.Text)
    private String category;

}
